<?php 
session_start();

@$isok=$_SESSION["islogin"];


if(!$isok){
    header("Refresh:3;url=diancanxitong.php");
    exit("请先登录！");
}

$pdo = new PDO("mysql:dbname=caipin;host=127.0.0.1;charset=UTF8", "root", "root");
$sql0 = $pdo->prepare("select * from  dindan  join zhuohao on zhuohao.zhuoid=dindan.zhuoId where dindan.jz='未结账'  ");
$sql0->execute();
$arr = $sql0->fetchAll(PDO::FETCH_NAMED);




?>

<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link type="text/css" rel="stylesheet" href="css/bootstrap.css">
    <link type="text/css" rel="stylesheet" href="css/bootstrap-theme.css">
    <script src="js/jQuery文件.js"></script>
    <script src="js/bootstrap.js"></script>
</head>
<body>
<nav class="navbar navbar-default">
    <div class="container-fluid" >
        <div class="navbar-header" >

                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="zhuohao.php" style="margin: 0 0 0 80px;font-size: 30px ">点餐系统</a>
                    </div>


                    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                        <ul class="nav navbar-nav">
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">订餐管理 <span class="caret"></span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="dindanliebiao.php">订单列表</a></li>
                                    <li><a href="dindanjilu.php">订单记录</a></li>       
                                </ul>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">菜品管理<span class="caret"></span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="caitianjia.php">添加菜品</a></li>
                                    <li><a href="cailiebiao.php">菜品列表</a></li>                             
                                    <li role="separator" class="divider"></li>
                                    <li><a href="cailiexing.php">添加菜品类型</a></li>                                
                                    <li><a href="cailiexingliebiao.php">菜品类型列表</a></li>
                                </ul>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">餐桌管理 <span class="caret"></span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="tianjia.php">添加餐桌</a></li>
                                    <li><a href="liebiao.php">餐桌列表</a></li>                                  
                                </ul>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">登录管理 <span class="caret"></span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="#">关于点餐系统</a></li>
                                    <li><a href="#"></a></li>
                                    <li><a href="#"></a></li>
                                    <li role="separator" class="divider"></li>
                                    <li><a href="xiugai.php">修改登录信息</a></li>                                
                                    <li><a href="tuichu.php" >退出登录</a></li>												  
                                </ul>
                            </li>
                        </ul>

                    </div>
                </div>

            </nav>
<div class="row">
	<div class="col-sm-offset-1 col-sm-2">
	<a href="dindanjilu.php" type="submit" class="btn btn-default btn-block">订单历史记录
	</a>
	<a href="zhuohao.php" type="submit" class="btn btn-default btn-block">返回首页
	</a>
    </div>


<div class="col-sm-8">


    <div class="panel panel-primary">
            <div class="panel-heading">
                <h1 class="panel-title">
                    <span class="glyphicon glyphicon-th-list"></span>
                                                           订单列表
                </h1>
            </div>
            <table class="table table-striped table-bordered table-hover">
                <tr>
                    <th>餐桌</th>
                    <th>生成日期</th>
                    <th>&nbsp;</th>
                </tr>
				<?php 
				
				
                             
					for($i=0;$i<count($arr);$i++){
                                $item=$arr[$i];
								
								?>
		
                            
                                <tr>
                    <td><?php echo $item["zhuoname"];?></td>	
                    <td><?php echo $item["shijian"];?></td>
                    <td>
                        <a href="#1<?php echo $item["did"];?>"data-toggle="modal">结账</a>
                        <a href="#<?php echo $item["did"];?>" data-toggle="modal">删除</a>

						
						
						
						
						
						
						<div class="modal fade" id="1<?php echo $item["did"];?>" tabindex="-1" >
                        	<div class="modal-dialog">
                        		<div class="modal-content">
                        			<div class="modal-header">
                        				<button type="button" class="close" data-dismiss="modal">
                        					<span>&times;</span><span class="sr-only">Close</span>
                        				</button>
                        				<h4 class="modal-title">确定结账[<?php echo $item["zhuoname"];?>]订单</h4>
                        			</div>
                        			<div class="modal-body">
                        			     你确定要结账餐桌[<?php echo $item["zhuoname"];?>]在[<?php echo $item["shijian"];?>]的订单吗？
                        			</div>
                        			<div class="modal-footer">
                        				<a type="button" class="btn btn-default" href="jiezhang.php?jzid=<?php echo $item["did"]."&czid=".$item["zhuoId"];?>">确定</a>
                        				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        			</div>
                        		</div>
                        	</div>
                        </div>
						
							
						
						<div class="modal fade" id="<?php echo $item["did"];?>" tabindex="-1" >
                        	<div class="modal-dialog">
                        		<div class="modal-content">
                        			<div class="modal-header">
                        				<button type="button" class="close" data-dismiss="modal">
                        					<span>&times;</span><span class="sr-only">Close</span>
                        				</button>
                        				<h4 class="modal-title">确定删除[<?php echo $item["zhuoname"];?>]订单</h4>
                        			</div>
                        			<div class="modal-body">
                        			     你确定要删除餐桌[<?php echo $item["zhuoname"];?>]在[<?php echo $item["shijian"];?>]的订单吗？
                        			</div>
                        			<div class="modal-footer">
                        				<a type="button" class="btn btn-default" href="sandindan.php?czddid=<?php echo $item["did"];?>">确定</a>
                        				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        			</div>
                        		</div>
                        	</div>
                        </div>
                    </td>
                </tr>
				<?php
					
				}
	?>
                            </table>
        </div>
	</div>
</div>

		<footer>
		  <hr/>
		  <p class="text-right"><small>点餐系统Demo@喻德软件快训</small></p>
		</footer>
	</div>

















</div>
</body>
<html>
